<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>BlueDoc Admin</title>
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>
    <% if Rails.env.development? %>
    <style type="text/css">
      .translation_missing { color: red !important; }
    </style>
    <% end %>

    <%= stylesheet_pack_tag 'bluedoc', 'data-turbolinks-track': 'reload' %>
    <%= stylesheet_pack_tag 'admin', 'data-turbolinks-track': 'reload' %>
    <script type="text/javascript" src="<%= asset_path("/js/jquery@3.3.1.js", skip_pipeline: true) %>"></script>
    <script type="text/javascript" src="<%= asset_path("/js/rails-ujs@5.2.1.js", skip_pipeline: true) %>"></script>
    <script type="text/javascript" src="<%= asset_path("/js/turbolinks@5.2.0.js", skip_pipeline: true) %>"></script>
    <script type="text/javascript" src="<%= asset_path("/js/react.production.min@16.6.1.js", skip_pipeline: true) %>"></script>
    <script type="text/javascript" src="<%= asset_path("/js/react-dom.production.min@16.6.1.js", skip_pipeline: true) %>"></script>
    <script type="text/javascript" src="<%= asset_path("/js/react-dom-server.browser.production.min@16.6.1.js", skip_pipeline: true) %>"></script>
    <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
  </head>

  <body class="admin-body">
    <%= react_component("Blank") %>

    <div class="nav-header">

      <div class="header-content container">
        <div class="navbar flex-none admin-navbar">
          <%= logo_tag href: "/admin" do %><%= t("admin.BlueDoc Admin") %><% end %>

          <%= render_list_items(class: "nav-link", type: :link, active_class: "selected") do |li|
            li <<  link_to(t("admin.Group"), admin_groups_path, class: "nav-link")
            li <<  link_to(t("admin.User"), admin_users_path, class: "nav-link")
            li <<  link_to(t("admin.Repository"), admin_repositories_path, class: "nav-link")
            li <<  link_to(t("admin.Doc"), admin_docs_path, class: "nav-link")
            li <<  link_to(t("admin.Note"), admin_notes_path, class: "nav-link")
            li <<  link_to(t("admin.Issue"), admin_issues_path, class: "nav-link")
            li <<  link_to(t("admin.Comment"), admin_comments_path, class: "nav-link")
            li <<  link_to(t("admin.Share"), admin_shares_path, class: "nav-link")
          end %>
        </div>
        <div class="flex-auto"></div>
        <div style="display:none">
          <%= render(partial: "/layouts/search_nav", locals: { props: { action: @nav_search_path, scope: @nav_search_scope, value: params[:q] } }) %>
        </div>
        <div class="navbar">
          <details class="dropdown details-reset details-overlay d-inline-block">
            <summary aria-haspopup="true">
              <%= user_avatar_tag(current_user, style: "tiny", link: false) %>
              <div class="dropdown-caret"></div>
            </summary>
            <div class="dropdown-menu dropdown-menu-sw">
              <div class="dropdown-header">
                <%= current_user.slug %>
              </div>
              <ul>
                <li><a class="dropdown-item" data-turbolinks="false" href="<%= root_path %>"><%= t("admin.Back to Front") %></a></li>
                <li class="dropdown-divider" role="separator"></li>
                <li><a class="dropdown-item" href="<%= destroy_user_session_path %>" data-method="delete"><%= t("admin.Sign out") %></a></li>
              </ul>
            </div>
          </details>
        </div>
      </div>
    </div>

    <%= notice_message %>
    <div class="main-container">
      <div class="container">
        <nav class="Breadcrumb mb-3">
          <ol>
            <li class="breadcrumb-item"><%= link_to t("admin.Admin"), admin_root_path %></li>
            <%= yield :breadcrumb %>
            <li class="breadcrumb-item breadcrumb-item-selected"><%= t("admin.#{action_name}") %></li>
          </ol>
        </nav>
        <%= yield %>
      </div>
    </div>

    <div class="footer pb-5">
      <div class="container">
        <a href="https://bluedoc.org" target="_blank">BlueDoc</a> <%= BlueDoc.full_version %>
      </div>
    </div>
  </body>
</html>
